package com.heima.wemedia.controller.v1;

import com.alibaba.fastjson.JSON;
import com.heima.model.article.dtos.ArticleCommentDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmNewsCommentDto;
import com.heima.model.wemedia.dtos.WmNewsPageReqDto;
import com.heima.model.wemedia.pojos.WmNewsComment;
import com.heima.wemedia.service.WmNewsCommentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/v1/comment/manage")
public class WmNewsCommentController {

    @Autowired
    private WmNewsCommentService wmNewsCommentService;

    @PostMapping("/find_news_comments")
    public PageResponseResult find_news_comments(@RequestBody ArticleCommentDto dto) {
        PageResponseResult newsComments = wmNewsCommentService.findNewsComments(dto);
        return newsComments;
    }

    @PostMapping("/update_comment_status")
    public ResponseResult update_comment_status(@RequestBody WmNewsCommentDto dto) {
        return wmNewsCommentService.update_comment_status(dto);
    }

    @PostMapping("/list")
    public ResponseResult list(@RequestBody WmNewsCommentDto dto) {
        return wmNewsCommentService.list(dto);
    }

    @PostMapping("/comment_repay")
    public ResponseResult comment_repay(@RequestBody ArticleCommentDto dto) {
        return wmNewsCommentService.comment_repay(dto);
    }

    @PostMapping("/like")
    public ResponseResult like(@RequestBody ArticleCommentDto dto) {
        return wmNewsCommentService.like(dto);
    }

    @DeleteMapping("/del_comment/{commentId}")
    public ResponseResult del_comment(@PathVariable String commentId) {
        return wmNewsCommentService.del_comment(commentId);
    }

    @DeleteMapping("/del_comment_repay/{commentRepayId}")
    public ResponseResult delCommentRepay(@PathVariable("commentRepayId") String commentRepayId) {
        return wmNewsCommentService.delCommentRepay(commentRepayId);
    }

}
